package it.unibo.iss.domotica.com;

import it.unibo.contact.platform.InteractPolicy;
import it.unibo.contact.platform.PlatformExpert;
import it.unibo.is.interfaces.*;
import it.unibo.is.interfaces.platforms.*;
import it.unibo.iss.domotica.EDDomain.Transmitter;

import java.util.Vector;
	

public abstract class  TransmitterSupport extends Subject{
	/* -------------------------------------
	* Local state of the subject
	* --------------------------------------
	*/
	
	protected String M = "someContent";	
	protected int lastMsgNum = 0; 
	private Transmitter obj = null; //The user must define Transmitter
//	private  IOutputView view;
	protected Vector<IMessage> inpList;
	
	/* -------------------------------------
	* OPERATIONS
	* --------------------------------------
	*/
	
	
	
	protected void transmitterForward_consumptionData_receiver() throws Exception{
		IOpOut support = PlatformExpert.findOutSupport("receiver","consumptionData","transmitter");
		support.forward( "transmitter", "consumptionData" , M, "receiver", InteractPolicy.nopolicy() );
//		showMsg( " has forwarded ... " + "consumptionData  to " + " receiver" );
	}
		
	/* -------------------------------------
	* Local body of the subject
	* --------------------------------------
	*/
 
	protected abstract void doJob() throws Exception;	/*{
	[]
	[]
 	 //	INPUT
   	prepareInput();
   	IMessage mm = selectOneInput(lastMsgNum, inpList);
   	elab(mm.msgId());
	//	OUTPUT
	{	 transmitterForward_consumptionData_receiver() ;
	}
 	}  */	

	


	

	
	/* -------------------------------------
	* Termination
	* --------------------------------------
	*/
	
protected void terminate() throws Exception{
	transmitterForward_consumptionData_receiverEnd();

	
//showMsg("  *** TERMINATED *** ");
}
//Teminate operations

	
	protected void transmitterForward_consumptionData_receiverEnd() throws Exception{
		IOpOut support = PlatformExpert.findOutSupport("receiver","consumptionData","transmitter");
		support.terminate();
	}
	
	

}
